//
//  MyCreateGroupDetailViewController.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/4/9.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "MyCreateGroupDetailViewController.h"
#import "GroupMemeberViewController.h"
#import "CreateGroupFinishViewController.h"
#import "GroupGongGaoViewController.h"
#import "GroupMingPianViewController.h"
#import "GroupMessageEditViewController.h"

@interface MyCreateGroupDetailViewController ()

@property (nonatomic, strong) UIScrollView *backGroupScrollView; // 背景scrollview
@property (nonatomic, strong) UIImageView *topImageV; // 顶部背景图片
@property (nonatomic, strong) UILabel *groupName; // 小组名字
@property (nonatomic, strong) UIImageView *groupImage; // 小组头像
@property (nonatomic, strong) UILabel *groupID; // 小组账号
@property (nonatomic, strong) UILabel *groupMark; // 小组标签
@property (nonatomic, strong) UILabel *groupMemberCount; // 组内成员人数
@property (nonatomic, strong) UILabel *groupMingPian; // 小组名片
@property (nonatomic, strong) UISwitch *groupSwitch; // 群组小组接收switch
@property (nonatomic, strong) UILabel *groupCreateTime; // 小组创建时间
@property (nonatomic, strong) UILabel *groupIntroduceDetail; // 小组介绍详情
@property (nonatomic, strong) UIButton *dissmissGroupButton; // 解散小组

@property (nonatomic, strong) UIView *offBackGroundView; // UISwitchOFF状态的背景

@end

@implementation MyCreateGroupDetailViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = YES;
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
     self.navigationController.navigationBar.hidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    // 布局
    [self addMySubview];
}

#pragma mark - 布局
- (void)addMySubview
{
    // 需要加一个无用的leftbar
    UIImageView *llll =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    llll.image = [UIImage imageNamed:@"houtui"];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:llll];
    // 背景scrollview
    self.backGroupScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, -20 * kAdjustParamater, kScreenWidth, kScreenHeight)];
    self.backGroupScrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight);
    self.backGroupScrollView.showsHorizontalScrollIndicator = NO;
    self.backGroupScrollView.showsVerticalScrollIndicator = NO;
    self.backGroupScrollView.bounces = NO;
    [self.view addSubview:_backGroupScrollView];
    
    // 顶部图片
    self.topImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 290 * kAdjustParamater)];
    self.topImageV.userInteractionEnabled = YES;
    self.topImageV.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.2];
    [self.backGroupScrollView addSubview:_topImageV];
    
    // 添加返回按钮
    UIImageView *leftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 30 * kAdjustParamater, 30 * kAdjustParamater, 30 * kAdjustParamater)];
    leftImageView.image = [UIImage imageNamed:@"houtui"];
    leftImageView.userInteractionEnabled = YES;
    [self.topImageV addSubview:leftImageView];
    UITapGestureRecognizer *tapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(returnToLastPage:)];
    [leftImageView addGestureRecognizer:tapGes];
    
    // 小组详情标题
    UILabel *groupTopTitle = [[UILabel alloc] initWithFrame:CGRectMake((375 - 200) / 2 * kAdjustParamater, 33 * kAdjustParamater, 200 * kAdjustParamater, 22 * kAdjustParamater)];
    groupTopTitle.text = @"小组详情";
    groupTopTitle.textAlignment = NSTextAlignmentCenter;
    groupTopTitle.textColor = [UIColor whiteColor];
    groupTopTitle.font = [UIFont systemFontOfSize:k17Big];
    [self.topImageV addSubview:groupTopTitle];
    
    // 小组头像
    self.groupImage = [[UIImageView alloc] initWithFrame:CGRectMake(90 * kAdjustParamater, 90 * kAdjustParamater, 85 * kAdjustParamater, 85 * kAdjustParamater)];
    self.groupImage.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupImage.layer.cornerRadius = 5 * kAdjustParamater;
    self.groupImage.layer.masksToBounds = YES;
    [self.topImageV addSubview:_groupImage];
    
    // 右边的添加图片
    UIImageView *addImageV = [[UIImageView alloc] initWithFrame:CGRectMake(self.groupImage.right + 20 * kAdjustParamater, self.groupImage.top, 85 * kAdjustParamater, 85 * kAdjustParamater)];
    addImageV.image = [UIImage imageNamed:@"huisetianjiakuang-fenzuguanli"];
    addImageV.userInteractionEnabled = YES;
    [self.topImageV addSubview:addImageV];
    
    // 为添加图片添加手势
    UITapGestureRecognizer *addImageGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectGroupImageV:)];
    [addImageV addGestureRecognizer:addImageGes];
    
    // 小组名字
    self.groupName = [[UILabel alloc] initWithFrame:CGRectMake(35 * kAdjustParamater, self.groupImage.bottom + 20 * kAdjustParamater, 200 * kAdjustParamater, 15 * kAdjustParamater)];
 //   self.groupName.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupName.text = @"壹基因交流群";
    self.groupName.textAlignment = NSTextAlignmentLeft;
    self.groupName.textColor = [UIColor whiteColor];
    self.groupName.font = [UIFont systemFontOfSize:15 * kAdjustParamater];
    [self.topImageV addSubview:_groupName];
    
    // 小组账号
    self.groupID = [[UILabel alloc] initWithFrame:CGRectMake(self.groupName.left, self.groupName.bottom + 8 * kAdjustParamater, 200 * kAdjustParamater, 15 * kAdjustParamater)];
   // self.groupID.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupID.text = @"123131231313";
    self.groupID.textColor = [UIColor whiteColor];
    self.groupID.textAlignment = NSTextAlignmentLeft;
    self.groupID.font = [UIFont systemFontOfSize:k15Big];
    [self.topImageV addSubview:_groupID];
    
    // 小组标签
    self.groupMark = [[UILabel alloc] initWithFrame:CGRectMake(self.groupName.left, self.groupID.bottom + 5 * kAdjustParamater, 300 * kAdjustParamater, 15 * kAdjustParamater)];
   // self.groupMark.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupMark.text = @"#健康达人#我爱看电影#";
    self.groupMark.textAlignment = NSTextAlignmentLeft;
    self.groupMark.textColor = [UIColor whiteColor];
    self.groupMark.font = [UIFont systemFontOfSize:k13Big];
    [self.topImageV addSubview:_groupMark];
    
    // 组内成员背景
    UIView *zuneiView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topImageV.bottom, kScreenWidth, 35 * kAdjustParamater)];
    zuneiView.backgroundColor = [UIColor whiteColor];
    [self.backGroupScrollView addSubview:zuneiView];
    
    // 添加手势
    UITapGestureRecognizer *zuneiTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToMember:)];
    [zuneiView addGestureRecognizer:zuneiTapGes];
    
    // 组内成员
    UILabel *zuNeiChengYuanLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 10 * kAdjustParamater, 100 * kAdjustParamater, 15 * kAdjustParamater)];
    zuNeiChengYuanLabel.text = @"组内成员";
    zuNeiChengYuanLabel.textColor = [UIColor blackColor];
    zuNeiChengYuanLabel.textAlignment  = NSTextAlignmentLeft;
    zuNeiChengYuanLabel.font = [UIFont systemFontOfSize:15 * kAdjustParamater];
    [zuneiView addSubview:zuNeiChengYuanLabel];
    
    // 组内人数
    self.groupMemberCount = [[UILabel alloc] initWithFrame:CGRectMake(305 * kAdjustParamater, 11 * kAdjustParamater, 40 * kAdjustParamater, 12 * kAdjustParamater)];
    self.groupMemberCount.text = @"100人";
    self.groupMemberCount.textAlignment = NSTextAlignmentRight;
    self.groupMemberCount.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];
    self.groupMemberCount.font = [UIFont systemFontOfSize:13 * kAdjustParamater];
    [zuneiView addSubview:_groupMemberCount];
    
    // 灰色箭头
    UIImageView *grayJianTouOnMemberCountRight = [[UIImageView alloc] initWithFrame:CGRectMake(self.groupMemberCount.right + 5 * kAdjustParamater, self.groupMemberCount.top - 2 * kAdjustParamater, 17 * kAdjustParamater, 17 * kAdjustParamater)];
    grayJianTouOnMemberCountRight.image = [UIImage imageNamed:@"grayJianTou"];
    [zuneiView addSubview:grayJianTouOnMemberCountRight];
    
    // 组内成员下方灰色条
    UILabel *grayLineOnZuNeiBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, zuneiView.bottom, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnZuNeiBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    [self.backGroupScrollView addSubview:grayLineOnZuNeiBottom];
    
    // 成员详情背景
    UIView *memberDetailBackground = [[UIView alloc] initWithFrame:CGRectMake(0, grayLineOnZuNeiBottom.bottom, kScreenWidth, 65 * kAdjustParamater)];
    memberDetailBackground.backgroundColor = [UIColor whiteColor];
    [self.backGroupScrollView addSubview:memberDetailBackground];
    // 成员详情手势
    UITapGestureRecognizer *memberDetailTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(memberDetailGes:)];
    [memberDetailBackground addGestureRecognizer:memberDetailTapGes];
    
    // 添加小组头像
    for (int i = 0; i < 5; i++) {
        // 构建头像
        UIImageView *tempImage = [[UIImageView alloc] initWithFrame:CGRectMake(15 * kAdjustParamater + 59 * i * kAdjustParamater, 10 * kAdjustParamater, 44 * kAdjustParamater, 44 * kAdjustParamater)];
        tempImage.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
        tempImage.layer.cornerRadius = tempImage.width / 2;
        tempImage.layer.masksToBounds = YES;
        [memberDetailBackground addSubview:tempImage];
    }
    
    // 添加加号
    UIImageView *addMemberImage = [[UIImageView alloc] initWithFrame:CGRectMake(310 * kAdjustParamater, 10 * kAdjustParamater, 44 * kAdjustParamater, 44 * kAdjustParamater)];
    addMemberImage.image = [UIImage imageNamed:@"huisejiaohao-myGroup"];
    addMemberImage.userInteractionEnabled = YES;
    [memberDetailBackground addSubview:addMemberImage];
    
    // 为加号添加手势
    UITapGestureRecognizer *addTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(addTap:)];
    [addMemberImage addGestureRecognizer:addTapGes];
    
    
    // 成员详情下方灰色条
    UILabel *grayLineOnMemberDetailBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, memberDetailBackground.bottom, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnMemberDetailBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroupScrollView addSubview:grayLineOnMemberDetailBottom];
    
    // 小组公告背景
    UIView *xiaozuGongGaoView = [[UIView alloc] initWithFrame:CGRectMake(0, grayLineOnMemberDetailBottom.bottom, kScreenWidth, 35 * kAdjustParamater)];
    xiaozuGongGaoView.backgroundColor = [UIColor whiteColor];
    [self.backGroupScrollView addSubview:xiaozuGongGaoView];
    
    // 为小组公告添加手势
    UITapGestureRecognizer *xiaozuGongGaoTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiaoZuGongGaoGes:)];
    [xiaozuGongGaoView addGestureRecognizer:xiaozuGongGaoTapGes];
    
    
    UILabel *xiaozuGongGaoLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 10 * kAdjustParamater, 100 * kAdjustParamater, 15 * kAdjustParamater)];
//    xiaozuGongGaoLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    xiaozuGongGaoLabel.text = @"小组公告";
    xiaozuGongGaoLabel.textColor = [UIColor blackColor];
    xiaozuGongGaoLabel.textAlignment = NSTextAlignmentLeft;
    xiaozuGongGaoLabel.font = [UIFont systemFontOfSize:k15Big];
    [xiaozuGongGaoView addSubview:xiaozuGongGaoLabel];
    
    UIImageView *xiaozuImageV = [[UIImageView alloc] initWithFrame:CGRectMake(350 * kAdjustParamater, 8 * kAdjustParamater, 17 * kAdjustParamater, 17 * kAdjustParamater)];
    xiaozuImageV.image = [UIImage imageNamed:@"grayJianTou"];
    [xiaozuGongGaoView addSubview:xiaozuImageV];
    
    // 小组公告下方的灰色条
    UILabel *grayLineOnXiaoZuGongGaoBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, xiaozuGongGaoView.bottom, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnXiaoZuGongGaoBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    [self.backGroupScrollView addSubview:grayLineOnXiaoZuGongGaoBottom];
    
    // 我的小组名片
    UIView *xiaozuMingPianView = [[UIView alloc] initWithFrame:CGRectMake(0, grayLineOnXiaoZuGongGaoBottom.bottom, kScreenWidth, 35 * kAdjustParamater)];
    xiaozuMingPianView.backgroundColor = [UIColor whiteColor];
    [self.backGroupScrollView addSubview:xiaozuMingPianView];
    
    // 为小组名片添加手势
    UITapGestureRecognizer *xiaozuMingPianTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiaozuMingPian:)];
    [xiaozuMingPianView addGestureRecognizer:xiaozuMingPianTapGes];
    
    // 小组名片
    UILabel *xiaozuMingPianLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 10 * kAdjustParamater, 100 * kAdjustParamater, 15 * kAdjustParamater)];
  //  xiaozuMingPianLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    xiaozuMingPianLabel.text = @"小组名片";
    xiaozuMingPianLabel.textColor = [UIColor blackColor];
    xiaozuMingPianLabel.textAlignment = NSTextAlignmentLeft;
    xiaozuMingPianLabel.font = [UIFont systemFontOfSize:k15Big];
    [xiaozuMingPianView addSubview:xiaozuMingPianLabel];
    
    
    // 我的小组名片
    self.groupMingPian = [[UILabel alloc] initWithFrame:CGRectMake(150 * kAdjustParamater, 11 * kAdjustParamater, 195 * kAdjustParamater, 12 * kAdjustParamater)];
  //  self.groupMingPian.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupMingPian.text = @"我是群主：张国文";
    self.groupMingPian.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];
    self.groupMingPian.textAlignment = NSTextAlignmentRight;
    self.groupMingPian.font = [UIFont systemFontOfSize:k13Big];
    [xiaozuMingPianView addSubview:_groupMingPian];
    
    UIImageView *xiaoZuMingPianImageV = [[UIImageView alloc] initWithFrame:CGRectMake(350 * kAdjustParamater, 8 * kAdjustParamater, 17 * kAdjustParamater, 17 * kAdjustParamater)];
    xiaoZuMingPianImageV.image = [UIImage imageNamed:@"grayJianTou"];
    [xiaozuMingPianView addSubview:xiaoZuMingPianImageV];
    
    // 小组名片下方的灰色条
    UILabel *grayLineOnXiaoZuMingPianBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, xiaozuMingPianView.bottom, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnXiaoZuMingPianBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    [self.backGroupScrollView addSubview:grayLineOnXiaoZuMingPianBottom];
    
    // 小组信息设置背景
    UIView *xiaozuXinXiView = [[UIView alloc] initWithFrame:CGRectMake(0, grayLineOnXiaoZuMingPianBottom.bottom, kScreenWidth, 35 * kAdjustParamater)];
    xiaozuXinXiView.backgroundColor = [UIColor whiteColor];
    [self.backGroupScrollView addSubview:xiaozuXinXiView];
    
    // 为小组信息背景添加手势
    UITapGestureRecognizer *xiaozuXinXiTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiaozuXinXi:)];
    [xiaozuXinXiView addGestureRecognizer:xiaozuXinXiTapGes];
    
    // 小组信息
    UILabel *xiaoZuXinXiLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 10 * kAdjustParamater, 150 * kAdjustParamater, 15 * kAdjustParamater)];
 //   xiaoZuXinXiLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    xiaoZuXinXiLabel.text = @"小组信息设置";
    xiaoZuXinXiLabel.textColor = [UIColor blackColor];
    xiaoZuXinXiLabel.textAlignment = NSTextAlignmentLeft;
    xiaoZuXinXiLabel.font = [UIFont systemFontOfSize:k15Big];
    [xiaozuXinXiView addSubview:xiaoZuXinXiLabel];
    
    UIImageView *xiaoZuXinXiImageV = [[UIImageView alloc] initWithFrame:CGRectMake(350 * kAdjustParamater, 8 * kAdjustParamater, 17 * kAdjustParamater, 17 * kAdjustParamater)];
    xiaoZuXinXiImageV.image = [UIImage imageNamed:@"grayJianTou"];
    [xiaozuXinXiView addSubview:xiaoZuXinXiImageV];
    
    // 消息信息设置下方的灰色条
    UILabel *grayLineOnXiaoZuXinXinBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, xiaozuXinXiView.bottom, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnXiaoZuXinXinBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    [self.backGroupScrollView addSubview:grayLineOnXiaoZuXinXinBottom];
    
    // 新消息通知背景
    UIView *newingMessageAlertView = [[UIView alloc] initWithFrame:CGRectMake(0, grayLineOnXiaoZuXinXinBottom.bottom, kScreenWidth, 45 * kAdjustParamater)];
    newingMessageAlertView.backgroundColor = [UIColor whiteColor];
    newingMessageAlertView.userInteractionEnabled = YES;
    [self.backGroupScrollView addSubview:newingMessageAlertView];
    
    // 新消息通知
    UILabel *newingMessageAlertLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 15 * kAdjustParamater, 100 * kAdjustParamater, 15 * kAdjustParamater)];
    newingMessageAlertLabel.text = @"新消息通知";
    newingMessageAlertLabel.textAlignment = NSTextAlignmentLeft;
    newingMessageAlertLabel.textColor = [UIColor blackColor];
    newingMessageAlertLabel.font = [UIFont systemFontOfSize:k15Big];
    [newingMessageAlertView addSubview:newingMessageAlertLabel];
    
    // switch
    self.groupSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(310 * kAdjustParamater, 10 * kAdjustParamater, 44 * kAdjustParamater, 25 * kAdjustParamater)];
    self.groupSwitch.on = YES;
    self.groupSwitch.onTintColor = kCyanColor;
    self.groupSwitch.tintColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    self.groupSwitch.thumbTintColor = [UIColor whiteColor];
    [self.groupSwitch addTarget:self action:@selector(actionChange:) forControlEvents:UIControlEventValueChanged];
    NSLog(@"宽度 = %f, 高度 = %f", self.groupSwitch.width, self.groupSwitch.height);
    [newingMessageAlertView addSubview:_groupSwitch];
    
    // 消息提醒下方的灰色条
    UILabel *grayLineOnNewingMessageAlertBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, newingMessageAlertView.bottom, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnNewingMessageAlertBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroupScrollView addSubview:grayLineOnNewingMessageAlertBottom];
    
    // 小组介绍
    UIView *groupIntroduceBackground = [[UIView alloc] initWithFrame:CGRectMake(0, grayLineOnNewingMessageAlertBottom.bottom, kScreenWidth, 35 * kAdjustParamater)];
    groupIntroduceBackground.backgroundColor = [UIColor whiteColor];
    [self.backGroupScrollView addSubview:groupIntroduceBackground];
    
    UILabel *groupIntroduceLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, 10 * kAdjustParamater, 100 * kAdjustParamater, 15 * kAdjustParamater)];
    groupIntroduceLabel.text = @"小组介绍";
    groupIntroduceLabel.textColor = [UIColor blackColor];
    groupIntroduceLabel.textAlignment  = NSTextAlignmentLeft;
    groupIntroduceLabel.font = [UIFont systemFontOfSize:16 * kAdjustParamater];
    [groupIntroduceBackground addSubview:groupIntroduceLabel];
    
    // 小组介绍下方的灰色条
    UILabel *grayLineOnIntroduceBackGroundBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, groupIntroduceBackground.bottom, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnIntroduceBackGroundBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroupScrollView addSubview:grayLineOnIntroduceBackGroundBottom];
    
    // 小组创建时间
    self.groupCreateTime = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, grayLineOnIntroduceBackGroundBottom.bottom + 10 * kAdjustParamater, 150 * kAdjustParamater, 12 * kAdjustParamater)];
    //   self.groupCreateTime.backgroundColor = [UIColor redColor];
    self.groupCreateTime.text = @"该小组创建于2016.1.1";
    self.groupCreateTime.textAlignment = NSTextAlignmentLeft;
    self.groupCreateTime.textColor = [UIColor blackColor];
    self.groupCreateTime.font = [UIFont systemFontOfSize:13 * kAdjustParamater];
    [self.backGroupScrollView addSubview:_groupCreateTime];
    
    // 小组介绍详情
    self.groupIntroduceDetail = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, self.groupCreateTime.bottom + 10 * kAdjustParamater, 345 * kAdjustParamater, 50 * kAdjustParamater)];
    self.groupIntroduceDetail.text = @"大师傅给为欧文和父亲问非全五分我发四女偶为接哦我就分为激发的少年班赛欧的你阿斯顿发送到交工前我Ian搜不过闹死偶发咨询丑女弄is的Fiona山东干";
    self.groupIntroduceDetail.textColor = [UIColor blackColor];
    self.groupIntroduceDetail.textAlignment = NSTextAlignmentLeft;
    self.groupIntroduceDetail.numberOfLines = 0;
    self.groupIntroduceDetail.font = [UIFont systemFontOfSize:13 * kAdjustParamater];
    // 自适应高度
    CGRect newFrame = self.groupIntroduceDetail.frame;
    newFrame.size.height = [[NetStatusHandle shareHandle] adjustHeight:self.groupIntroduceDetail.text size:13 width:345];
    self.groupIntroduceDetail.frame = newFrame;
    [self.backGroupScrollView addSubview:_groupIntroduceDetail];
    
    // 小组介绍详情下方的灰色条
    UILabel *grayLineOnGroupIntroduceDetailBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, self.groupIntroduceDetail.bottom + 10 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnGroupIntroduceDetailBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroupScrollView addSubview:grayLineOnGroupIntroduceDetailBottom];
    
    // 申请入组button
    self.dissmissGroupButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.dissmissGroupButton.frame = CGRectMake((375 - 265) / 2 * kAdjustParamater, grayLineOnGroupIntroduceDetailBottom.bottom + 35 * kAdjustParamater, 265 * kAdjustParamater, 40 * kAdjustParamater);
    self.dissmissGroupButton.backgroundColor = [UIColor colorWithRed:84 / 255.0 green:199 / 255.0 blue:222 / 255.0 alpha:1];
    self.dissmissGroupButton.layer.cornerRadius = 6 * kAdjustParamater;
    [self.dissmissGroupButton setTitle:@"解 散 小 组" forState:UIControlStateNormal];
    [self.dissmissGroupButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.dissmissGroupButton.titleLabel.font = [UIFont systemFontOfSize:20 * kAdjustParamater];
    [self.dissmissGroupButton addTarget:self action:@selector(wantToDissmissGroup:) forControlEvents:UIControlEventTouchUpInside];
    [self.backGroupScrollView addSubview:_dissmissGroupButton];
    
    // 改变scrollview
    self.backGroupScrollView.height = self.dissmissGroupButton.bottom + 50 * kAdjustParamater;
    self.backGroupScrollView.contentSize = CGSizeMake(kScreenWidth, self.backGroupScrollView.height + 100 * kAdjustParamater);
    
}

#pragma mark - 添加UISwicthOFF状态的背景
- (void)addUISwitchOFFStateBackgroundView:(UIColor *)color
{
    self.offBackGroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 51, 31)];
    self.offBackGroundView.backgroundColor = color;
    self.offBackGroundView.layer.cornerRadius = self.offBackGroundView.height / 2;
    [self.offBackGroundView.layer setShouldRasterize:YES];
    [self.offBackGroundView.layer setRasterizationScale:[UIScreen mainScreen].scale];
    [self.groupSwitch addSubview:_offBackGroundView];
    [self.groupSwitch sendSubviewToBack:_offBackGroundView];
}


#pragma mark - 返回上一个界面
- (void)returnToLastPage:(UITapGestureRecognizer *)tapGes
{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - 组内成员
- (void)goToMember:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"组内成员");
    GroupMemeberViewController *groupMemberVC = [[GroupMemeberViewController alloc] init];
    [self.navigationController pushViewController:groupMemberVC animated:YES];
}

#pragma mark - 添加成员
- (void)addTap:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"添加成员");
    CreateGroupFinishViewController *createGroupFinishVC = [[CreateGroupFinishViewController alloc] init];
    [self.navigationController pushViewController:createGroupFinishVC animated:YES];
}

#pragma mark - 成员详情背景的手势
- (void)memberDetailGes:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"成员详情背景");
    GroupMemeberViewController *groupMemberVC = [[GroupMemeberViewController alloc] init];
    [self.navigationController pushViewController:groupMemberVC animated:YES];
}

#pragma mark - 小组公告
- (void)xiaoZuGongGaoGes:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"小组公告");
    GroupGongGaoViewController *groupGongGaoVC = [[GroupGongGaoViewController alloc] init];
    [self.navigationController pushViewController:groupGongGaoVC animated:YES];
}

#pragma mark - 小组名片
- (void)xiaozuMingPian:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"小组名片");
    GroupMingPianViewController *groupMingPianVC = [[GroupMingPianViewController alloc] init];
    [self.navigationController pushViewController:groupMingPianVC animated:YES];
}

#pragma mark - 小组信息
- (void)xiaozuXinXi:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"小组信息设置");
    GroupMessageEditViewController *groupMessageEditVC = [[GroupMessageEditViewController alloc] init];
    [self.navigationController pushViewController:groupMessageEditVC animated:YES];
}

#pragma mark - switch状态改变
- (void)actionChange:(UISwitch *)mySwitch
{
    if (mySwitch.on == NO) {
        NSLog(@"关闭消息提醒");
        [self addUISwitchOFFStateBackgroundView:[[UIColor blackColor] colorWithAlphaComponent:0.05]];
    } else if (mySwitch.on == YES) {
        NSLog(@"开启消息提醒");
        [self.offBackGroundView removeFromSuperview];
    }
}

#pragma mark - 解散小组
- (void)wantToDissmissGroup:(UIButton *)button
{
    NSLog(@"解散小组");
}

#pragma mark - 选择小组头像
- (void)selectGroupImageV:(UITapGestureRecognizer *)tapGes
{
    NSLog(@"选择小组头像");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
